<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}CFS Web System{% endblock %}</title>
    
    <!-- Bootstrap CSS -->
    <link href="{% load static %}{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
    <!-- Bootstrap Icons -->
    <link href="{% load static %}{% static 'css/bootstrap-icons.css' %}" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <!-- 自定义样式 -->
    <link href="{% load static %}{% static 'css/style.css' %}" rel="stylesheet">
    
    {% block extra_css %}{% endblock %}
</head>
<body data-page="{% block page_type %}default{% endblock %}">
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <div class="container-fluid">
            <a class="navbar-brand" href="{% url 'dashboard:dashboard' %}">
                <i class="fas fa-file-excel me-2"></i>
                CFS Web System
            </a>
            
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link {% if request.resolver_match.url_name == 'dashboard' %}active{% endif %}" 
                           href="{% url 'dashboard:dashboard' %}">
                            <i class="fas fa-tachometer-alt me-1"></i>
                            仪表板
                        </a>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                            <i class="fas fa-cogs me-1"></i>
                            模板管理
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="{% url 'template_management:template_list' %}">
                                <i class="fas fa-list me-1"></i>模板列表
                            </a></li>
                            <li><a class="dropdown-item" href="{% url 'template_management:template_create' %}">
                                <i class="fas fa-plus me-1"></i>创建模板
                            </a></li>
                        </ul>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                            <i class="fas fa-file-upload me-1"></i>
                            文件管理
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="{% url 'file_manager:dashboard' %}">
                                <i class="fas fa-folder me-1"></i>文件管理
                            </a></li>
                            <li><a class="dropdown-item" href="{% url 'data_processing:data_generation' %}">
                                <i class="fas fa-upload me-1"></i>上传文件
                            </a></li>
                        </ul>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                            <i class="fas fa-play me-1"></i>
                            数据处理
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="{% url 'excel_processor:status' %}">
                                <i class="fas fa-tasks me-1"></i>处理任务
                            </a></li>
                            <li><a class="dropdown-item" href="{% url 'data_processing:data_generation' %}">
                                <i class="fas fa-magic me-1"></i>数据生成
                            </a></li>
                        </ul>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link {% if request.resolver_match.url_name == 'log_viewer' %}active{% endif %}" 
                           href="{% url 'log_analysis:log_viewer' %}">
                            <i class="fas fa-chart-line me-1"></i>
                            日志分析
                        </a>
                    </li>
                </ul>
                
                <ul class="navbar-nav">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                            <i class="fas fa-user me-1"></i>
                            用户
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end">
                            <li><a class="dropdown-item" href="#">
                                <i class="fas fa-user-cog me-1"></i>个人设置
                            </a></li>
                            <li><hr class="dropdown-divider"></li>
                            <li><a class="dropdown-item" href="#">
                                <i class="fas fa-sign-out-alt me-1"></i>退出登录
                            </a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
    
    <!-- 面包屑导航 -->
    {% block breadcrumb %}
    <nav aria-label="breadcrumb" class="bg-light py-2">
        <div class="container-fluid">
            <ol class="breadcrumb mb-0">
                <li class="breadcrumb-item"><a href="{% url 'dashboard:dashboard' %}">首页</a></li>
                {% block breadcrumb_items %}{% endblock %}
            </ol>
        </div>
    </nav>
    {% endblock %}
    
    <!-- 通知容器 -->
    <div id="notification-container"></div>
    
    <!-- 主要内容 -->
    <main class="container-fluid py-4">
        {% block content %}{% endblock %}
    </main>
    
    <!-- 页脚 -->
    <footer class="bg-dark text-light py-4 mt-5">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-6">
                    <h6>CFS Web System</h6>
                    <p class="mb-0">Excel文件处理和数据生成系统</p>
                </div>
                <div class="col-md-6 text-md-end">
                    <p class="mb-0">
                        <small class="text-muted">
                            版本 1.0.0 | 
                            <a href="#" class="text-light">帮助文档</a> | 
                            <a href="#" class="text-light">技术支持</a>
                        </small>
                    </p>
                </div>
            </div>
        </div>
    </footer>
    
    <!-- 加载遮罩 -->
    <div id="loading-overlay" class="loading-overlay" style="display: none;">
        <div class="loading-content">
            <div class="loading-spinner"></div>
            <p class="mt-3">处理中，请稍候...</p>
        </div>
    </div>

    <!-- Toast 通知容器 -->
    <div class="toast-container position-fixed top-0 end-0 p-3" style="z-index: 11000;">
        <!-- Toast 消息将动态插入到这里 -->
    </div>
    
    <!-- Bootstrap JS -->
    <script src="{% load static %}{% static 'js/bootstrap.bundle.min.js' %}"></script>
    <!-- 自定义JavaScript -->
    {% load static %}
    <script src="{% static 'js/main.js' %}"></script>
    
    {% block extra_js %}{% endblock %}
    
    <!-- CSRF Token -->
    <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
</body>
</html>